RAIS  3.2
C:/Projekte/RAIS/common/DataRoleAttribute.cs
Go to the documentation of this file.
00001 
00028 using System;
00029 using System.Collections.Generic;
00030 using System.Text;
00031 using System.Data;
00032 
00033 namespace RAIS.Common.UserManagement
00034 {
00038     public class DataRoleAttribute
00039     {
00040         #region Fields
00041         //DataRole dataRole ;                      ///<Data role object
00042         Region region;                             
00043         District district;             
00044         Facility facility;             
00045         #endregion
00046         #region Properties
00047 
00050                 //public DataRole DataRole
00051                 //{
00052                 //    get { return this.dataRole; }
00053                 //    set { this.dataRole = value; }
00054                 //}
00058         public Region Region
00059         {
00060             get { return this.region; }
00061             set { this.region = value; }
00062         }
00066         public District District
00067         {
00068             get { return this.district; }
00069             set { this.district = value; }
00070         }
00074         public Facility Facility
00075         {
00076             get { return this.facility; }
00077             set { this.facility = value; }
00078         }
00082                 public string RegionName
00083                 {
00084                         get { return this.region.Name; }
00085                 }
00089                 public string DistrictName
00090                 {
00091                         get { return this.district.Name; }
00092                 }
00096                 public string FacilityName
00097                 {
00098                         get { return this.facility.Name; }
00099                 }
00100                 #endregion
00101         #region Public methods
00102         public bool RestricitonsConflict(DataRoleAttribute attribute)
00103         {
00104             if (this.Region.RestricitonsConflict(attribute.Region))
00105                 return true;
00106             else
00107                 if (this.Region.Name == attribute.Region.Name &&
00108                     this.District.RestricitonsConflict(attribute.District))
00109                     return true;
00110                 else
00111                     if (this.Region.Name == attribute.Region.Name &&
00112                         this.District.Name == attribute.District.Name &&
00113                         this.Facility.RestricitonsConflict(attribute.Facility))
00114                         return true;
00115                     else
00116                         return false;
00117         }
00118         #endregion
00119         #region Constructors
00120         public DataRoleAttribute()
00121         {}
00122         public DataRoleAttribute(/*DataRole dataRole,*/ IDataRecord record)
00123                 {
00124                         //this.dataRole = dataRole;
00125                         this.region = new Region(record);
00126                         this.district = new District(record);
00127                         this.facility = new Facility(record);
00128                 }
00129                 #endregion
00130         #region Overridables
00131         public override string ToString()
00132         {
00133             return this.Region.Name + " " + this.District.Name + " " + this.Facility.Name;
00134         }
00135         #endregion
00136     }
00137 }